package com.example.demo.core.service;

import com.example.demo.core.entity.Permission;
import com.example.demo.core.repository.PermissionRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionService {

    @Autowired
    private PermissionRepository permissionRepository;

    /**
    * @Description: 获取全部权限
    * @Param:  无
    * @return:  全部权限的列表
    * @Author: wangze
    */
    public List<Permission> getPermissionList(){
        return permissionRepository.findAll();
    }

    /**
     * @Description: 根据权限ID获取权限
     * @Param:  id: 权限ID
     * @return:  权限实体
     * @Author: wangze
     */
    public  Permission findPermissionById(Integer id) { return permissionRepository.findPermissionById(id); }
}
